package com.sjb.cp.model.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * @Author:sjb
 * @CreateTime:2025-02-20
 * @Description: 图片编辑操作类型枚举
 * @Version：1.0
 */
@Getter
public enum PictureEditActionEnum {

    ZOOM_IN("放大操作", "ZOOM_IN"),
    ZOOM_OUT("缩小操作", "ZOOM_OUT"),
    ROTATE_LEFT("左旋操作", "ROTATE_LEFT"),
    ROTATE_RIGHT("右旋操作", "ROTATE_RIGHT");

    private final String text;
    private final String value;


    PictureEditActionEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 获取enum根据value
     * @param value
     * @return
     */
    public static PictureEditActionEnum getEnumByValue(String value) {
        if (StrUtil.isEmpty(value)){
            return null;
        }
        for (PictureEditActionEnum pictureEditActionEnum : PictureEditActionEnum.values()) {
            if (pictureEditActionEnum.getValue().equals(value)) {
                return pictureEditActionEnum;
            }
        }
        return null;
    }
}
